package com.sky.mapper;

import com.sky.anotation.AllFull;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

//@Mapper
public interface DishMapper {

	DishVO dishById(Integer id);

	List<DishVO> page(DishPageQueryDTO queryDTO);

	@Select("select count(*) from dish")
	Integer total();

	DishVO dishById(Long id);

	@AllFull(OperationType.UPDATE)
	@Update("update dish set status = #{status}, update_time = #{updateTime}, update_user = #{updateUser} where id = #{id}")
	Integer status(Dish dish);

	@AllFull(OperationType.UPDATE)
	Integer update(Dish dish);

	@AllFull(OperationType.INSERT)
	Integer insert(Dish dish);

	Integer deleteBatch(List<Long> idList);
	@Select("select image from dish where id = #{id}")
	String image(Long id);

	@Select("select count(*) from dish where category_id = #{categoryId}")
	Integer dishCountByCategoryId(Long categoryId);
}
